package com.fit.entities;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.tapestry5.beaneditor.NonVisual;
import org.apache.tapestry5.beaneditor.Validate;

@Entity
@Table(name = "product")
public class Product {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@NonVisual
	@Column(name = "id")
	private Long id;
	@Column(name = "name", nullable = false)
	@Validate("required")
	private String name;
	@Validate("required")
	@Column(name = "model", nullable = false)
	private String model;
	@Validate("required")
	@Column(name = "type", nullable = false)
	private String type;
	@Validate("required")
	@Column(name = "price", nullable = false)
	public double price;
	@Validate("required")
	@Column(name = "items_left", nullable = false)
	private Long items_left;
	@Validate("required")
	@Column(name = "total_sold")
	private Long total_sold;
	
	@Validate("required")
	@ManyToOne(optional = false)
	@JoinColumn(name = "product_manufacturer")
	private Manufacturer manufacturer;
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getModel() {
		return model;
	}
	public void setModel(String model) {
		this.model = model;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	public Long getItems_left() {
		return items_left;
	}
	public void setItems_left(Long items_left) {
		this.items_left = items_left;
	}
	
	
	public Long getTotal_sold() {
		return total_sold;
	}
	public void setItems_sold(Long total_sold) {
		
		
		this.total_sold = total_sold;
	}
	public Manufacturer getManufacturer() {
		return manufacturer;
	}
	public void setManufacturer(Manufacturer manufacturer) {
		this.manufacturer = manufacturer;
	}
	
	

	

}
